<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use App\Models\Users;

use Gregwar\Captcha\CaptchaBuilder;
class LoginController extends Controller
{
	public function index()
	{
		return view("admin.login");
	}

	public function doLogin(Request $request){
		$user = new Users();
		$ob=$user->checkUser($request);
		if($ob){
			session(["adminuser"=>$ob]);
			return redirect('/admin/index');
		}else{
			return back()->with("msg","登陆失败");
		}
		
	}

	public function logout(){
		session()->forget('adminuser');
		return view("admin.login");
	}
}